package com.yunji.cabinet.service.impl;

import com.yunji.cabinet.bo.CabinetCellListQueryBO;
import com.yunji.cabinet.bo.TemplateCellResetBO;
import com.yunji.cabinet.dao.ICabinetTemplateCellDao;
import com.yunji.cabinet.domain.CabinetTemplateCellDO;
import com.yunji.cabinet.service.ICabinetTemplateCellService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @version 1.0
 * @Project: yunji-coffee
 * @Package com.yunji.cabinet.service.impl
 * @FileName CabinetTemplateCellServiceImpl.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * Company		com
 * @CreateTime 2024-04-07 17:01:27
 * @Description 货柜模板格子接口实现
 * @Modification Author                    History Time			Version				Description
 * --------------------------------------------------------------------------------
 * HuaAo				2024-04-07 17:01:27		1.0					1.0 Version
 * @since JDK 1.8.0_202
 */
@Service
public class CabinetTemplateCellServiceImpl implements ICabinetTemplateCellService {

    @Resource
    ICabinetTemplateCellDao cabinetTemplateCellDao;

    /**
     * @param cell 模板格子信息
     * @Title create
     * @Desc 创建模板格子信息
     * @Date 2024-09-02 19:53:02.152
     * @Return boolean 创建结果
     */
    @Override
    public boolean create(CabinetTemplateCellDO cell) {
        return cabinetTemplateCellDao.save(cell);
    }

    /**
     * @param ids 模板ID数组
     * @Title delete
     * @Desc 删除模板格子信息
     * @Date 2024-09-02 19:53:33.379
     * @Return boolean 删除结果
     */
    @Override
    public boolean deleteByTemplateIds(Long... ids) {
        return cabinetTemplateCellDao.deleteByTemplateIds(Arrays.asList(ids));
    }

    @Override
    public boolean resetCell(TemplateCellResetBO cell) {
        return cabinetTemplateCellDao.resetCell(cell) > 0;
    }

    @Override
    public List<CabinetTemplateCellDO> searchTemplateCells(CabinetCellListQueryBO param) {
        return cabinetTemplateCellDao.searchTemplateCells(param);
    }
}
